home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / dev / mui / mui37_de.lha / Amiga-E / Examples / Boopsidoor.e < prev    next >
Text File  |  1996-08-25  |  4KB  |  121 lines

  1. /*
  2. **  Original C Code written by Stefan Stuntz
  3. **
  4. **  Translation into E by Klaus Becker
  5. **
  6. **  All comments are from the C-Source
  7. */
  8.  
  9. /*
  10. ** This program needs at least V39 include files !
  11. */
  12.  
  13. OPT PREPROCESS
  14.  
  15. MODULE 'muimaster','libraries/mui','libraries/muip',
  16.        'mui/muicustomclass','amigalib/boopsi',
  17.        'intuition/classes','intuition/classusr',
  18.        'intuition/screens','intuition/intuition',
  19.        'utility/tagitem',
  20.        'gadgets/colorwheel','colorwheel',
  21.        'intuition/icclass','intuition/gadgetclass'
  22.  
  23. /*
  24. ** Gauge object macro to display colorwheels
  25. ** hue and saturation values.
  26. */
  27.  
  28. #define InfoGauge GaugeObject,\
  29.   GaugeFrame    , \
  30.   MUIA_Background  , MUII_BACKGROUND,\
  31.   MUIA_Gauge_Max   , 16384,\
  32.   MUIA_Gauge_Divide, 262144,\
  33.   MUIA_Gauge_Horiz , MUI_TRUE,\
  34.   End
  35.  
  36.  
  37. PROC main() HANDLE
  38.  
  39.   DEF app,window,wheel,hue,sat,sigs=0
  40.   
  41.   IF (muimasterbase:=OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN 
  42.     Raise('Failed to open muimaster.library')
  43.   IF  (colorwheelbase:=OpenLibrary('gadgets/colorwheel.gadget',0))=NIL THEN
  44.     Raise('colorwheel boopsi gadget not available')
  45.   app:= ApplicationObject,
  46.     MUIA_Application_Title      , 'BoopsiDoor',
  47.     MUIA_Application_Version    , '$VER: BoopsiDoor 14.19 (21.02.96)',
  48.     MUIA_Application_Copyright  , 'c1992/93, Stefan Stuntz',
  49.     MUIA_Application_Author     , 'Stefan Stuntz & Klaus Becker',
  50.     MUIA_Application_Description, 'Show a boopsi colorwheel with MUI.',
  51.     MUIA_Application_Base       , 'BOOPSIDOOR',
  52.     SubWindow, window:= WindowObject,
  53.       MUIA_Window_Title, 'BoopsiDoor',
  54.       MUIA_Window_ID   , "BOOP",
  55.       WindowContents, VGroup,
  56.         Child, ColGroup(2),
  57.           Child, Label('Hue:'       ), Child, hue:= InfoGauge,
  58.           Child, Label('Saturation:'), Child, sat:= InfoGauge,
  59.           Child, RectangleObject,MUIA_Weight,0,End, Child, ScaleObject, End,
  60.         End,
  61.         Child, wheel:= BoopsiObject,  /* MUI and Boopsi tags mixed */
  62.           GroupFrame,
  63.           MUIA_Boopsi_ClassID  , 'colorwheel.gadget',
  64.           MUIA_Boopsi_MinWidth , 30, /* boopsi objects don't know */
  65.           MUIA_Boopsi_MinHeight, 30, /* their sizes, so we help   */
  66.           MUIA_Boopsi_Remember , WHEEL_SATURATION, /* keep important values */
  67.           MUIA_Boopsi_Remember , WHEEL_HUE,        /* during window resize  */
  68.           MUIA_Boopsi_TagScreen, WHEEL_SCREEN, /* this magic fills in */
  69.           WHEEL_SCREEN         , NIL,         /* the screen pointer  */
  70.           GA_LEFT     , 0,
  71.           GA_TOP      , 0, /* MUI will automatically     */
  72.           GA_WIDTH    , 0, /* fill in the correct values */
  73.           GA_HEIGHT   , 0,
  74.           ICA_TARGET  , ICTARGET_IDCMP, /* needed for notification */
  75.           WHEEL_SATURATION, 0, /* start in the center */
  76.           MUIA_FillArea, MUI_TRUE, /* use this because it defaults to FALSE
  77.                                   for boopsi gadgets but the colorwheel
  78.                                   doesnt bother about redrawing its background */
  79.         End,
  80.       End,
  81.     End,
  82.   End
  83.  
  84.   IF app=NIL THEN Raise('Failed to create Application.')
  85.  
  86. /*
  87. ** you can react on every boopsi notification
  88. ** event as on any other MUI attribute.
  89. */
  90.  
  91.   doMethodA(wheel,[MUIM_Notify,WHEEL_HUE       ,MUIV_EveryTime,hue,4,MUIM_Set,MUIA_Gauge_Current,MUIV_TriggerValue])
  92.   doMethodA(wheel,[MUIM_Notify,WHEEL_SATURATION,MUIV_EveryTime,sat,4,MUIM_Set,MUIA_Gauge_Current,MUIV_TriggerValue])
  93.  
  94.   doMethodA(window,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit])
  95.  
  96. /*
  97. ** This is the ideal input loop for an object oriented MUI application.
  98. ** Everything is encapsulated in classes, no return ids need to be used,
  99. ** we just check if the program shall terminate.
  100. ** Note that MUIM_Application_NewInput expects sigs to contain the result
  101. ** from Wait() (or 0). This makes the input loop significantly faster.
  102. */
  103.  
  104.   set(window,MUIA_Window_Open,MUI_TRUE)
  105.  
  106.   WHILE doMethodA(app,[MUIM_Application_NewInput,{sigs}])<> MUIV_Application_ReturnID_Quit
  107.     IF sigs THEN sigs:=Wait(sigs)
  108.   ENDWHILE
  109.   set(window,MUIA_Window_Open,FALSE)
  110.  
  111. /*
  112. ** shut down.
  113. */
  114.  
  115. EXCEPT DO
  116.   IF app THEN Mui_DisposeObject(app)
  117.   IF colorwheelbase THEN CloseLibrary(colorwheelbase)
  118.   IF muimasterbase THEN CloseLibrary(muimasterbase)
  119.   IF exception THEN WriteF('\s\n',exception)
  120. ENDPROC
  121.